import 'dart:io';

import 'package:base/common/init/init_handle.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class Config extends InitHandle<void> {
  bool get isAndroid => Platform.isAndroid;
  bool get isiOS => Platform.isIOS;

  @override
  void get data => throw UnimplementedError();

  @override
  Future<void> init() async {
    await SystemChrome.setPreferredOrientations(
        [DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);
    SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle.light;
    if (isAndroid) {
      /// Android
      /// 沉浸式导航栏
      systemUiOverlayStyle =
          SystemUiOverlayStyle.light.copyWith(statusBarColor: Colors.transparent);
    }
    SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
  }
}
